package logic

import (
	"context"
	"meituan_srv/model/redisinit"

	"meituan_srv/internal/svc"
	"meituan_srv/meituan"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeleteCartLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDeleteCartLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteCartLogic {
	return &DeleteCartLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 清除购物车
func (l *DeleteCartLogic) DeleteCart(in *meituan.DeleteCartRequest) (*meituan.DeleteCartResponse, error) {
	// todo: add your logic here and delete this line

	redisinit.DeleteCart(in.UserId)
	return &meituan.DeleteCartResponse{}, nil
}
